import type { ComputedRef } from 'vue'

import type { LabelValue } from '../../types'
export type PopoverType = 'filterList' | 'date' | 'select' | 'check'
export type FilterPopover = Exclude<PopoverType, 'filterList'>

export type PopoverOption = {
  select?: LabelValue[] | ComputedRef<LabelValue[]>
  check?: LabelValue[]
  dateProps?: {
    startKey: string
    endKey: string
    startDisabledDate?: () => any
    endDisabledDate?: () => any
  }
}

export type FilterItem = {
  label: string
  field: string
  validate?: (args?: any) => Promise<boolean>
  message?: string
  messageModel?: 'notification' | 'message'
  maxLength?: number
  popover?: FilterPopover
  popoverOption?: PopoverOption
}

export type SearchValue = {
  label: string
  field: string
  isDate?: boolean
  dateStartKey?: string
  dateEndKey?: string
  value: (string | number)[]
  text?: string[]
  options: LabelValue[]
}
